﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Controller;
using System.Threading;

namespace Pixysoft.Weblications.Sango.Thread
{
    class BaseSangoThread : IThreadPoolRunnable
    {
        bool isDisposed = false;

        bool isRunning = false;

        WaitHandle waitHandler;

        RegisteredWaitHandle registerdHandler;

        public bool IsRunning
        {
            get { return isRunning; }
            set { isRunning = value; }
        }

        public bool IsDisposed
        {
            get { return isDisposed; }
            set { isDisposed = value; }
        }

        public virtual void Run(object state, bool timeOut)
        {
        }

        public WaitHandle WaitHandler
        {
            get { return waitHandler; }
            set { waitHandler = value; }
        }

        public RegisteredWaitHandle RegisterdHandler
        {
            get { return registerdHandler; }
            set { registerdHandler = value; }
        }

        public virtual void Dispose()
        {
            this.isDisposed = true;

            this.isRunning = false;

            this.waitHandler = null;

            this.registerdHandler = null;
        }
    }
}
